﻿// JYZSDlg.cpp: 实现文件
//

#include "pch.h"
#include "3180101584SX1.h"
#include "JYZSDlg.h"
#include "afxdialogex.h"

extern OpenImageClass OImageC;

// JYZSDlg 对话框

IMPLEMENT_DYNAMIC(JYZSDlg, CDialog)

JYZSDlg::JYZSDlg(CWnd* pParent /*=nullptr*/)
	: CDialog(IDD_DIALOG_JYZS, pParent)
{

}

JYZSDlg::~JYZSDlg()
{
}

void JYZSDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(JYZSDlg, CDialog)
	ON_BN_CLICKED(IDC_BUTTON_LAYOUT, &JYZSDlg::OnBnClickedButtonLayout)
END_MESSAGE_MAP()


// JYZSDlg 消息处理程序


void JYZSDlg::OnBnClickedButtonLayout()
{
	long int BlackNum;
	CString sBlackNum;
	long int WhiteNum;
	CString sWhiteNum;
	GetDlgItemText(IDC_EDIT_BLACK, sBlackNum);
	GetDlgItemText(IDC_EDIT_BLACK, sWhiteNum);
	if (sBlackNum == "")
	{
		BlackNum = 0;
	}
	else
	{
		BlackNum = _ttoi(sBlackNum);
	}
	if (sWhiteNum == "")
	{
		WhiteNum = 0;
	}
	else
	{
		WhiteNum = _ttoi(sWhiteNum);
	}
	
	OImageC.SaltPepperNoise_RGBFunc(OImageC.etmImg, WhiteNum, BlackNum);
	OImageC.GencRemoColorImgFunc(OImageC.etmImg, OImageC.etmImg->FastWidth, OImageC.etmImg->FastHeight);
	OImageC.PaintRemoteImgFunc(hdc, OImageC.etmImg);
	
}


BOOL JYZSDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	pDC = this->GetDC();

	CWnd* pWnd = AfxGetMainWnd();     //获取主窗口指针

	CDC * pDC = pWnd->GetDC();
	hdc = pDC->GetSafeHdc();

	return TRUE;  // return TRUE unless you set the focus to a control
				  // 异常: OCX 属性页应返回 FALSE
}
